<template>
	<portlet name="公司信息">
        <Row>
            <i-col span="7">
                <div class="company_infor">
                    <img :src='contactInfor.pic'>
                    <br/>
                    <span>{{contactInfor.comName}}</span>
                </div>
            </i-col>
            <i-col span="7">
                <div class="contact_infor">
                    <ul>
                        <li>
                            <Icon size='15' type="android-person"></Icon>
                            &nbsp;&nbsp;&nbsp;
                            {{contactInfor.name}}
                        </li>
                        <li>
                            <Icon size='15' type="ios-telephone"></Icon>
                            &nbsp;&nbsp;&nbsp;
                            {{contactInfor.phone}}
                        </li>
                        <li>
                            <Icon size='15' type="ios-email"></Icon>
                            &nbsp;&nbsp;&nbsp;
                            {{contactInfor.email}}
                        </li>
                    </ul>
                </div>
            </i-col>
            <i-col span="5">
                <div class="account_infor">
                    <div>
                        <strong>{{sum}}</strong>
                        <br/>
                        <span class='importance'>当前余额</span>
                    </div>
                    <div>
                        <strong>{{accountInfor.transfer}}</strong>
                        <br/>
                        <span>累计到账</span>
                    </div>
                </div>
            </i-col>
            <i-col span="5">
                <div class="account_infor account_infor_b">
                    <div>
                        <strong>{{accountInfor.consume}}</strong>
                        <br/>
                        <span>累计消费</span>
                    </div>
                    <div>
                        <strong>{{accountInfor.recharge}}</strong>
                        <br/>
                        <span>累计充值</span>
                    </div>
                </div>
            </i-col>
        </Row>
        <Row>
            <i-col span="4">
                <div class="net_infor">
                    <h4>
                        公司接入接口参数
                    </h4>
                </div>
            </i-col>
            <i-col span="8">
                <div class="net_infor">
                    <table>
                        <tr>
                            <th>公司编码</th>
                            <td>{{netInfor.comCode}}</td>
                        </tr>
                        <tr>
                            <th>签名串</th>
                            <td>{{netInfor.signature}}</td>
                        </tr>
                        <tr>
                            <th>加密串</th>
                            <td>{{netInfor.secret}}</td>
                        </tr>
                    </table>
                </div>
            </i-col>
            <i-col span="3">
                <div class="net_infor net_infor_b">
                    <h4>
                        IP白名单
                    </h4>
                </div>
            </i-col>
            <i-col span="4">
                <div class="net_infor ">
                    <table>
                        <tr>
                            <th>生产环境</th>
                            <td>{{netInfor.whiteList}}</td>
                        </tr>
                    </table>
                </div>
            </i-col>
        </Row>
    </portlet>
</template>
<script>
	import Portlet from '../../components/portlet.vue';
    export default {
    	components:{ Portlet },
        data () {
            return {
                contactInfor: {
                    pic:this.publicPath+'/src/images/con_pic.png',
                    comName:'',
                    name:'',
                    phone:'',
                    email:'',
                },
                accountInfor:{
                    transfer:'',
                    consume:'',
                    recharge:''
                },
                netInfor:{
                    comCode:'',
                    signature:'',
                    secret:'',
                    whiteList:''
                },
            }
        },
        methods: {
        },
        computed:{
            sum(){
                return (this.accountInfor.recharge-this.accountInfor.consume-this.accountInfor.transfer).toFixed(2);
            },
        },
        ready(){
         this.$nextTick(()=>{
             this.$http.jsonp(this.path+'company/companyDownServlet/toDetailPage',{
                // params:{company_code:this.store.state.user.company_code,},
                jsonp:'callback'
             }).then(
                (datas)=>{
                    if(datas.body.code=='001'){
                        // console.log(datas.body);
                        // this.store.state.user.companyId=datas.body.result.id;
                        // this.store.state.user.companyName=datas.body.result.company_name;
                        // this.store.state.allInfor=datas.body.result;
                        this.contactInfor.name=datas.body.result.company_man;
                        this.contactInfor.comName=datas.body.result.company_name;
                        this.contactInfor.phone=datas.body.result.company_tel;
                        this.contactInfor.email=datas.body.result.company_email;
                        this.accountInfor.transfer=datas.body.result.money_tiaozhang;
                        this.accountInfor.consume=datas.body.result.money_xiaofei;
                        this.accountInfor.recharge=datas.body.result.money_chongzhi;
                        this.netInfor.recharge=datas.body.result.login_no;
                        this.netInfor.signature=datas.body.result.signature;
                        this.netInfor.secret=datas.body.result.secret_key;
                        this.netInfor.whiteList=datas.body.result.money_chongzhi;
                    }else if(datas.body.code=='002'){
                            this.$Message.success('提交信息出错p!');
                    }else if(datas.body.code=='997'||datas.body.code=='998'){
                            this.store.state.user.companyId=null;
                            this.store.state.user.companyName=null;
                            this.store.state.allInfor=null;
                            this.$Message.error('登陆超时或未登陆,请登陆!');
                            this.myRouter.go({path:'/login'});
                    }
                },
                (error)=>{
                    this.$Message.success('网络问题!');
                }   
             );
         })
        }
    }
</script>
<style scoped lang="less" rel="stylesheet/scss">
    @import '../../styles/home.scss';
</style>